
#pragma once

#include "EngineCommand.h"

namespace FlameEngine
{
	class RenderEngine;
	class CoreEngine;
	class IRenderWindow;

	class EngineManager
	{
	public:
		EngineManager(char* pCmdLine,IRenderWindow* pRenderWnd);

		~EngineManager();

		//Get EngineManager instance
		inline static EngineManager* GetInst();
		
		//Start game engine
		void Run();

		//
		inline CoreEngine* GetCoreEngine();

		//
		inline RenderEngine* GetRenderEngine();

		void RegisterCmdProcessor();

	private:
		static EngineManager* s_pInstance;

	protected:
		void OnWndCreated();
		void CreateRenderSystem();

		void RunOneFrame();
		void Run_mainThread();

		void Run_renderThread();


	private:
		EngineManager(const EngineManager&);
		EngineManager(const EngineManager&&);
		EngineManager& operator= (const EngineManager&);


		CoreEngine* m_pCoreEngine;
		RenderEngine* m_pRenderEngine;

	};

	inline EngineManager* EngineManager::GetInst(){ return s_pInstance; }
	inline CoreEngine* EngineManager::GetCoreEngine(){ return m_pCoreEngine; }
	inline RenderEngine* EngineManager::GetRenderEngine(){ return m_pRenderEngine; }
}